package utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

//实现链式调用
public class MapControl {
    private Map<String,Object> paramMap=new HashMap<String,Object>();
    //构造函数私有化
    private MapControl(){}
    //提供获取对象的静态方法
    public static MapControl getInstance(){
        return new MapControl();
    }

    public Map<String,Object> getMap(){
        return paramMap;
    }

    public MapControl put(String key,Object val){
        paramMap.put(key, val);
        return this;
    }
    public MapControl page(List<?> data,Integer count){
        return this.put("msg","返回成功").put("code",0).put("count",count).put("data",data);
    }
}
